package com.tca.spring.framework.learning.mybatis;

import com.tca.spring.framework.learning.mybatis.config.AnnotationMybatisConfig;
import com.tca.spring.framework.learning.mybatis.config.MybatisConfig;
import com.tca.spring.framework.learning.mybatis.dao.InfoMapper;
import com.tca.spring.framework.learning.mybatis.entity.Info;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author zhoua
 * @Date 2021/7/28
 */
@Slf4j
public class MybatisStarter {


    public static void main(String[] args) {
//        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MybatisConfig.class);
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AnnotationMybatisConfig.class);
        InfoMapper infoMapper = applicationContext.getBean(InfoMapper.class);
        Info info = infoMapper.selectById(1);
        log.info("info = {}", info);
    }
}
